<?php
// anti direct-access
if (!defined('MEKARSARI_WEBGIS'))
	exit('Direct access to this script is prohibited.');

function getSession($var, $subvar = NULL){
	if( !$subvar )
		return isset($_SESSION[$var]) ? $_SESSION[$var] : NULL;
	else
		return isset($_SESSION[$var][$subvar]) ? $_SESSION[$var][$subvar] : NULL;
}

function giveAuth($username, $subbagian, $level){
	$_SESSION['s_username'] = $username;
	
	if( !isset($_SESSION['s_auth']) || $_SESSION['s_auth'] == '' ){
		$_SESSION['s_auth'] = array($subbagian => $level);
	}elseif( is_array($_SESSION) ){
		$_SESSION['s_auth'] = array_merge($_SESSION['s_auth'], array($subbagian=>$level));
	}
	$_SESSION['s_login']	= TRUE;	
}
?>